package chain_of_responsibility

import "fmt"

type CheeseHandler struct {
	next Handler
}

func NewCheeseHandler(next Handler) Handler {
	return &CheeseHandler{next: next}
}

func (h *CheeseHandler) HandleRequest(req *OrderRequest) {
	if req.Cheese {
		fmt.Println("CheeseHandler execute......")
	}
	if h.next != nil {
		h.next.HandleRequest(req)
	}
}
func (h *CheeseHandler) SetNext(handler Handler) {
	h.next = handler
}
